package edu.sctu.renpingan.seekhomework;

import java.io.IOException;

/**
 * Created by Administrator on 2015/6/30.
 */
public class LogicConnecting {
    public void logicConnecting() throws IOException {
       StopCmd stopCmd = new StopCmd();
        ThreadUtil threadUtil = new ThreadUtil();

        //对cmd运行时的提示语进行申明
        String notice1 = " 中添加全部成员的Word文档，添加完成后重新运行程序   注：命名格式为学号+“-”+“姓名”+“-”+其它  例如：1406101000-任萍安-其他信息";
        String notice2 = " 中添加成员新提交的Word文档，添加完成后重新运行程序   注：命名格式为学号+“-”+“姓名”+“-”+其它  例如：1406101000-任萍安-其他信息";
        String notice3 = " 输入exit关闭当前页面";
        String notice4 = " 此界面将在30秒后自动关闭，请迅速进行相应的操作";
        //对储存文档的文件夹进行创建
        JudgeIsFile judgeIsFile = new JudgeIsFile(Path.SAVE_FILE_PATH,Path.NEW_ADD_FILE_PATH);
        judgeIsFile.JudgeAndCreatNewFile();
        judgeIsFile.JudgeAndCreatSaveFile();
        if(judgeIsFile.judgeSaveFileIsEmpty()){
            System.out.println("请在 "+ Path.SAVE_FILE_PATH +"\n"+ notice1);
            //让当前界面停止30秒
            System.out.println(notice4);
            threadUtil.run();

//            stopCmd.stopcmd();
        }else if(judgeIsFile.judgeAndAddFileIsEmpty()){
            System.out.println("请在 " + Path.NEW_ADD_FILE_PATH +"\n"+ notice2);
            //让当前界面停止30秒
            System.out.println(notice4);
            threadUtil.run();

//            stopCmd.stopcmd();
            //信息添加完成后进行比对还有谁未提交文档
        }else if(!judgeIsFile.judgeSaveFileIsEmpty() && !judgeIsFile.judgeAndAddFileIsEmpty()){
            GetInfoAndUtil getInfoAndUtil = new GetInfoAndUtil(Path.SAVE_FILE_PATH,Path.NEW_ADD_FILE_PATH);
            getInfoAndUtil.getInfo();
            getInfoAndUtil.getInfo1();
            getInfoAndUtil.getInfo2();
            getInfoAndUtil.seeking();
            stopCmd.stopcmd();
            System.out.println("\n"+notice3);
        }


    }
}
